TEMPLATE = app
TARGET = 
OBJECTS_DIR = build
MOC_DIR = build
RCC_DIR = build
UI_DIR = build
HEADERS += src/screengrab.h \
    src/instancer.h \
    src/configwidget.h \
    src/config.h \
    src/mainwindow.h \
    src/regionselect.h \
    src/cmdline.h \
    src/about.h
unix:HEADERS += src/common/netwm/netwm.h
SOURCES += main.cpp \
    src/screengrab.cpp \
    src/instancer.cpp \
    src/configwidget.cpp \
    src/config.cpp \
    src/mainwindow.cpp \
    src/regionselect.cpp \
    src/cmdline.cpp \
    src/about.cpp
unix:SOURCES += src/common/netwm/netwm.cpp
RESOURCES += screengrab.qrc
OTHER_FILES += docs/LICENSE.txt \
    screengrab.desktop \
    screengrab.rc \
    docs/README.txt \
    docs/ChangeLog.txt
FORMS += src/configwidget.ui \
    src/mainwindow.ui \
    src/aboutwidget.ui
TRANSLATIONS += localize/screengrab_ru.ts \
    localize/screengrab_pt_BR.ts

# lrelease
isEmpty(QMAKE_LRELEASE) { 
    win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\lrelease.exe
    else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
    !exists($$QMAKE_LRELEASE):QMAKE_LRELEASE = lrelease-qt4 \
        }
    updateqm.input = TRANSLATIONS
    updateqm.output = localize/${QMAKE_FILE_BASE}.qm
    updateqm.commands = $$QMAKE_LRELEASE \
        -silent \
        ${QMAKE_FILE_IN} \
        -qm \
        localize/${QMAKE_FILE_BASE}.qm
    updateqm.CONFIG += no_link
    
    # target_predeps
    QMAKE_EXTRA_COMPILERS += updateqm
    PRE_TARGETDEPS += compiler_updateqm_make_all
    unix { 
        # select prefix
        isEmpty( PREFIX ):PREFIX = /usr
        else:PREFIX = $${PREFIX}
        PREFIXSTR = '\\"$${PREFIX}\\"'
        DEFINES += PREFIX=\"$${PREFIXSTR}\"
        
        # generate instal
        target.path = $${PREFIX}/bin
        localize.depends = localize/*.qm
        localize.path = $${PREFIX}/share/screengrab/localize
        localize.files = localize/*.qm
        docs.path = $${PREFIX}/share/doc/screengrab
        docs.files = LICENSE \
            README \
            ChangeLog
        menu.path = $${PREFIX}/share/applications
        menu.files = screengrab.desktop
        menuicon.path = $${PREFIX}/share/pixmaps
        menuicon.files = img/screengrab.png
        INSTALLS += target \
            localize \
            menu \
            menuicon \
            docs
    }
    
    # win32 res file
    win32:RC_FILE = screengrab.rc
    win32:LIBS += libgdi32
    
    # generate VERSION
    STABLE_VERSION = 0.0-alpha
    VERSION = $${STABLE_VERSION}
    VERSTR = '\\"$${VERSION}\\"' # place quotes around the version string
    DEFINES += VERSION=\"$${VERSTR}\" # create a VER macro containing the version string
